package Server;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

import map.Map;

import org.newdawn.slick.Graphics;


public class ServerMap extends Map
{
	ServerSocket serverSocket;
	Socket clientSocket;
	
	Scanner in;
	DataOutputStream out;
	
	public ServerMap()
	{
		startServer();
	}
	
	public void startServer()
	{
		try 
		{
			serverSocket = new ServerSocket(4446);
			clientSocket = serverSocket.accept();
			
			in = new Scanner(clientSocket.getInputStream());
			out = new DataOutputStream(clientSocket.getOutputStream());
			
			ServerConnection sc = new ServerConnection(in, out, mapLayers[1]);
			new Thread(sc).start();
		} 
		
		catch (IOException e) 
		{
			e.printStackTrace();
		}
	}
	
	@Override
	public void render(Graphics g)
	{
		super.render(g);
	}
}
